package top.maohh.study.demo.zookeeper.config;

public class ZookeeperConfig {
    public static final String ZK_ADDRESS = "0.0.0.0:2181";
    public static final Integer ZK_TIMEOUT = 2000;
    public static final String ZK_GROUP_NAME = "HOME_TREE";

    /**
     * int到byte[] 由高位到低位
     *
     * @param i 需要转换为byte数组的整行值。
     * @return byte数组
     */
    public static byte[] intToByteArray(int i) {
        byte[] result = new byte[4];
        result[0] = (byte) ((i >> 24) & 0xFF);
        result[1] = (byte) ((i >> 16) & 0xFF);
        result[2] = (byte) ((i >> 8) & 0xFF);
        result[3] = (byte) (i & 0xFF);
        return result;
    }
}
